<template>
    <section v-if="load">
      <div class="loading" :style="{background: background}">
        <!-- <img width="24px" height="24px" src="../images/timg.gif"> -->
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <p class="desc" :style="{color: color}">{{title}}</p>
      </div>
    </section>
  </template>
  <script>
  export default {
    props: {
      title: {
        type: String,
        default: '正在载入...'
      },
      color: {
        type: String,
        default: '#fff'
      },
      load : {
        type: Boolean,
        default : false
      },
      background : {
        type: String,
        default: 'rgba(0, 0, 0, 0.7)'
      }
    }
  }
  </script>
  <style scoped>

  .desc{
    margin-top: 30px;
    font-size: 16px;
  }

  .fade-enter-active,
  .fade-leave-active {
    transition: opacity 0.5s;
  }
  .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
    opacity: 0;
  }
  section {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    /* background: rgba(0, 0, 0, 0.4); */
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .loading {
    padding: 40px 30px;
    width: 120px;
    text-align: center;
    flex-direction: column;
    border-radius: 30px;
  }
  .loading span {
    display: inline-block;
    width: 8px;
    height: 100%;
    border-radius: 4px;
    background: lightgreen;
    -webkit-animation: load 1s ease infinite;
    margin-left: 5px;
  }
  @-webkit-keyframes load {
    0%,
    100% {
      height: 40px;
      background: lightgreen;
    }
    50% {
      height: 70px;
      margin: -15px 0;
      background: lightblue;
    }
  }
  .loading span:nth-child(2) {
    -webkit-animation-delay: 0.2s;
  }
  .loading span:nth-child(3) {
    -webkit-animation-delay: 0.4s;
  }
  .loading span:nth-child(4) {
    -webkit-animation-delay: 0.6s;
  }
  .loading span:nth-child(5) {
    -webkit-animation-delay: 0.8s;
  }
  </style>
  